import moment from "moment"

// 环境变量
const env = process.env.NODE_ENV as string
const versionKey = import.meta.env.VITE_VERSION as string
// 未使用！
const IP = {
  development: {  // 本地开发
    API_URL: 'http://127.0.0.1'
  },
  production: { // 正式发布
    API_URL: 'http://127.0.0.1'
  },
  test: { // 本地测试
    API_URL: 'http://127.0.0.1'
  }
} as any

// @ts-ignore
const API_URL = IP[env]?.API_URL as any
const dev = (env == 'development' || env == 'test')
/** 资源路径 */
const versionFileMap = {
  base: '/',
  gitee: '/gs/',
  github: '/gs/',
  render: '/'
} as any
const FILE_BASE = versionFileMap[versionKey];

function getVersion() {
  let version = __APP_INFO__?.lastBuildTime
  let part = version || moment().format("YYMMDD")
  let mainVersion = 1
  // 每次发布修改的小版本号
  let subVersion = 4
  return `V${mainVersion}.${subVersion}.${part}`
}
const version = getVersion();

// 项目信息
const projectInfo = {
  owner: 'dusw',
  repo: 'genshin-front-vite',
  branch: 'master'
}

// webIDE编辑的文件路径
const editPathMap = {
  Genshin: {
    Role: 'src/data/genshin_role.ts',
    Weapon: 'src/data/genshin_weapon.ts',
    Book: 'src/data/genshin_book.ts',
    Item: 'src/data/genshin_item.ts',
    Pool: 'src/data/genshin_pool.ts',
    Card: 'src/data/genshin_card.ts'
  },
  Honkai: {
    Role: 'src/data/honkai_role.ts',
  },
  StarRail: {
    Role: 'src/data/star_rail_role.ts',
    Weapon: 'src/data/star_rail_weapon.ts'
  },
  ZZZ: {
    Role: 'src/data/zzz_role.ts',
    Weapon: 'src/data/zzz_weapon.ts',
    Bangboo: 'src/data/zzz_bangboo.ts',
    Suit: 'src/data/zzz_suit.ts',
  },
  Waves: {
    Role: 'src/data/waves_role.ts',
    Weapon: 'src/data/waves_weapon.ts',
    Item: 'src/data/waves_item.ts',
    Echoes: 'src/data/waves_echoes.ts',
    Effect: 'src/data/waves_effect.ts',
  },
  BlueArchive: {
    Student: 'src/data/blue_archive_student.ts',
    NPC: 'src/data/blue_archive_npc.ts'
  },
}

export {
  API_URL, env, dev, version, FILE_BASE, projectInfo, editPathMap
}